def call(String emailRecipient) {
  switch(currentBuild.result) {
    case 'FAILURE':
    emailext (
      subject: "${currentBuild.fullDisplayName} - Build Failed",
      body: "The Jenkins job has failed. Check Jenkins for details. Job: ${env.JOB_URL}",
      to: emailRecipient
    )
    break
    case 'SUCCESS':
    emailext (
      subject: "${currentBuild.fullDisplayName} - Build Succeeded",
      body: "The Jenkins job has succeeded. Check Jenkins for details. Job: ${env.JOB_URL}",
      to: emailRecipient
    )
    break
  }
}